import Vue from 'vue'
import Vuex from 'vuex'
import { gettoken, removetoken, settoken } from '@/utils/auth'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    tokenobj: gettoken() || {},
    userinfo: {}
    
  },
  getters: {},
  mutations: {
    changetoken (state, obj) {
      state.tokenobj = obj
      settoken(obj)
    },
    changeuserinfo (state, obj) {
      state.userinfo = obj
    },
    remtoken (state) {
      state.tokenobj = {}
      removetoken()
    }
  },
  actions: {},
  modules: {}
})
